// 调用封装好的角色列表接口
import {roleList} from '../../../util/request/api'
//封装角色管理的状态管理
const state = {
    // 仓库
    rolelist:[]
}

const getters ={
    getRoleList(state){
        // 获取值
        return state.rolelist
    }
}

const mutations = {
    REQ_ROLELIST(state,payload){
        // 接值，赋值
        state.rolelist = payload
    }
}

const actions ={
    getRoleAction({commit}){
        roleList()
        .then(res=>{
            if(res.code==200){
                // 传值
                commit('REQ_ROLELIST',res.list)
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}